#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
ENV ASPNETCORE_URLS http://+:5000
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["ManageSystem/ManageSystem.csproj", "ManageSystem/"]
COPY ["ManageSystem.Service/ManageSystem.Service.csproj", "ManageSystem.Service/"]
COPY ["ManageSystem.Repository/ManageSystem.Repository.csproj", "ManageSystem.Repository/"]
COPY ["ManageSystem.Model/ManageSystem.Model.csproj", "ManageSystem.Model/"]
COPY ["ManageSystem.IRepository/ManageSystem.IRepository.csproj", "ManageSystem.IRepository/"]
COPY ["ManageSystem.IService/ManageSystem.IService.csproj", "ManageSystem.IService/"]
COPY ["ManageSystem.Common/ManageSystem.Common.csproj", "ManageSystem.Common/"]
COPY ["AuthorizationRequirement/ManageSystem.AuthorizationRequirement.csproj", "AuthorizationRequirement/"]
COPY ["MagageSystem.Core/ManageSystem.SetUp.csproj", "MagageSystem.Core/"]
RUN dotnet restore "ManageSystem/ManageSystem.csproj"
COPY . .
WORKDIR "/src/ManageSystem"
RUN dotnet build "ManageSystem.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ManageSystem.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY ["ManageSystem/ManageSystem.xml", "/app/"]
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ManageSystem.dll"]